package com.gainloop.Adapters;

import java.util.LinkedList;

import com.gainloop.R;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;


public class TagAdapter extends BaseAdapter{
	
	private LinkedList<String> _currentAddedTagsStr;
	
	public TagAdapter(LinkedList<String> currentAddedTagsStr){
		_currentAddedTagsStr =  currentAddedTagsStr ;
	}

	@Override  
    public int getCount() {  
        return _currentAddedTagsStr.size();  
    }  

    @Override  
    public Object getItem(int position) {  
        return _currentAddedTagsStr.get(position);  
    }  

    @Override  
    public long getItemId(int position) {  
        return position;  
    }  

    @Override  
    public View getView(int position, View convertView, ViewGroup parent) {  
        View retval = LayoutInflater.from(parent.getContext()).inflate(R.layout.tag_list_item, null);  
        
        retval.setPadding(5, 1, 1, 1);
        
        String tagNameStr = _currentAddedTagsStr.get(position);
        Button tagName = (Button) retval.findViewById(R.id.tag_list_item_name);  
        tagName.setText(tagNameStr);  
  
        
        return retval;  
    }
	
}
